package com.gcxy.utils;

import com.gcxy.dto.export.DownloadFileDTO;
import com.gcxy.service.ExportRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author qinlun
 * @date 2023/10/8
 */
@Slf4j
@Component
public class AsyncThreadUtil {

    @Autowired
    private ExportRecordService exportRecordService;

    @Async
    public void asyncCreateFile(DownloadFileDTO dto, String targetPath) {
        log.info("执行异步操作。。。。");
        exportRecordService.createFile(dto, targetPath);
        log.info("结束异步操作。。。。");
    }
}
